<template>
  <PageWrapper>
    <BasicTable class="page-search-table" @register="registerTable">
      <template #operation="{ record }">
        <TableAction
          :actions="[
            {
              label: '查看',
              onClick: goSee.bind(null, record),
            },
          ]"
        />
      </template>
    </BasicTable>
    <logDetail ref="logDetailRef" />
  </PageWrapper>
</template>
<script lang="ts">
  import { defineComponent, ref } from 'vue';
  import { BasicTable, useTable, TableAction } from '/@/components/Table';
  import { PageWrapper } from '/@/components/Page';
  import { useModal } from '/@/components/Modal';
  import { tableConfig } from './tableData';
  import logDetail from './logDetail.vue';

  export default defineComponent({
    components: { PageWrapper, BasicTable, TableAction, logDetail },
    setup() {
      const [registerModel, { openModal: openModal }] = useModal();
      const [registerTable] = useTable(tableConfig);
      const logDetailRef = ref();
      function goSee(record) {
        logDetailRef.value.message = record.message;
        logDetailRef.value.visible = true;
      }
      return {
        logDetailRef,
        goSee,
        openModal,
        registerTable,
        registerModel,
      };
    },
  });
</script>
